home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
answrbok
/
5_7.lha
/
5_7
/
5_7b2.c
< prev
next >
Wrap
Text File
|
1993-08-08
|
517b
|
31 lines
* Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
* The C++ Answer Book */
* Tony Hansen */
* All rights reserved. */
/ Add one to the bin which contains a.
/ If none contains a, increment the
/ underflow or overflow count.
include <histogram.h>
oid histogram:: add(int value)
if (value < lovals[0])
underflow++;
else
{
for (int i = 1; i <= nbin; i++)
if (value < lovals[i])
{
h[i-1]++;
break;
}
if (i > nbin)
overflow++;
}
sum += value;
sqsum += value * value;